<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import = "com.xiaonei.model.*,com.xiaonei.DAO.*,java.util.ArrayList,java.util.Iterator;" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>话题分类</title>
</head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0">
<%
    response.setCharacterEncoding("utf-8");
	String type=null;
	String topic=null;
	int typeCount=0;
	ArrayList<String> typeList=new ArrayList<String>();
	ArrayList<String> topicList=new ArrayList<String>();
	TopicDAOImpl topicDAOImpl=new TopicDAOImpl();
	typeList=topicDAOImpl.typeList();
	typeCount=topicDAOImpl.typeCount();
	
	String temp = request.getParameter("num");
	int schoolNum =100;
	schoolNum=Integer.parseInt(temp);
%>

	<table width="100%">
		<tr>
			<%--内表格第一行 只有一列--%>
			<td width="100%" align="center">
			<a>话题分类</a>
			</td>
		</tr>
<%for(int i=0;i<typeCount;i++){ 
%>
		<%--第一行开始 --%>
		<tr>
			<td  valign="top">
				<%--第一行内表格开始 --%>
				<table width="100%">
					<%--内表格第一行开始 --%>
					<tr>
						<%--内表格第一行 只有一列--%>
						<td width="100%" align="left">
							<%out.println(typeList.get(i));%>
						</td>
					</tr>
					<tr>
						<td width="100%" align="left">
							<%
							topicList=topicDAOImpl.toipcOfTypeList(typeList.get(i));
							%>
			
							<%
							for(int j=0;j<topicList.size();j++){ 
								topic=topicList.get(j);
								//给内容 找话题id；传话题id到另一个页面；
								//直接传话题内容到另一个页面；  这里用的是这个
							
							%>	
								<a href="OneTopic.jsp?num=<%=schoolNum %>&topicContent=<%=topic %>&iPage=1">
								<% out.println(topic);%>
								</a>
							<% 	
							}%>
							<hr />
					   
					   	</td>
					</tr>
				</table>
			</td>
		</tr>
<% }%>	
		
	</table>
</body>
</html>